/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author liuwei
* @date 2021-06-07
**/
@Entity
@Data
@Table(name="track_device")
public class TrackDevice implements Serializable {

    @Column(name = "user_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "用户ID")
    private Long userId;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "device_id")
    @ApiModelProperty(value = "追踪设备ID")
    private Long deviceId;

    @Column(name = "type",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "设备类型")
    private String type;

    @Column(name = "stat")
    @ApiModelProperty(value = "是否登录")
    private Boolean stat;

    @Column(name = "user")
    @ApiModelProperty(value = "账号")
    private String user;

    @Column(name = "pass")
    @ApiModelProperty(value = "密码")
    private String pass;

    @Column(name = "phone",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "手机号")
    private String phone;

    @Column(name = "haed")
    @ApiModelProperty(value = "定位接口请求头")
    private String haed;

    @Column(name = "param")
    @ApiModelProperty(value = "设备定位参数")
    private String param;

    @Column(name = "avatar_name")
    @ApiModelProperty(value = "头像地址")
    private String avatarName;

    @Column(name = "avatar_path")
    @ApiModelProperty(value = "头像真实路径")
    private String avatarPath;

    public void copy(TrackDevice source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}